<?php
require_once 'classes/Login.php';
require_once 'classes/JobPost.php';
$Login = new Login;
if(!$Login->verify())
{
    header('Location:login.php');
}
$companyName = $Login->getCompanyName($_SESSION['employerID']);

include 'includes/header.inc.php';

$JobPost = new JobPost;

$state1 = $JobPost->getStateName($_POST['state1']);
if(isset($_POST['state2'])) {
$state2 = $JobPost->getStateName($_POST['state2']); }
if(isset($_POST['state3'])) {
$state3 = $JobPost->getStateName($_POST['state3']); }
if(isset($_POST['state4'])) {
$state4 = $JobPost->getStateName($_POST['state4']); }
if(isset($_POST['state5'])) {
$state5 = $JobPost->getStateName($_POST['state5']); }

?>
        <div id="postBox">
        <section id="advancedSearch">
            <h2>Advanced Search</h2>
            <form id="advSearch" action="#">
                <div id="leftAdvS" class="advS">
                    <label for="what">what</label>
                    <input id="what" type="text" />
                    <small>Job title, keywords, or company name</small>
                </div>
                <div id="centerAdvS" class="advS">
                    <label for="where">where</label>
                    <input id="where" type="text" />
                    <small>City, State, or Zip (Optional)</small>
                </div>
                <div id="rightAdvS" class="advS">
                    <input type="submit" name="advSearch" id="advSearch" class="button" value="Find Jobs" />
                </div>
            </form>
        </section>
        <hr />
        <section id="jobPost">
            <form>
                <input type="hidden" id="formName" name="formName" value="submitPost"/>
                <input type="hidden" id="employerID" name="employerID" value="<?php echo $_SESSION['employerID']; ?>"/>
            <?php
			if(defined('hideName')) {
					echo $_POST['hideName'];
			}
					foreach ($_POST as $key => $value)
					{
						if($key != 'formName')
						{
							print '<input type="hidden" id="'.$key.'" name="'.$key.'" value="'.$value.'"/>';
						}
					}
			
            ?>
            </form>
            <h2><?php echo $_POST['jobTitle']; ?></h2>
            <?php
			if((defined('hideName')) || (defined('hideSalary'))) {
                if($_POST['hideName'] != 'on'){ echo '<p><strong>Company Name:</strong> '.$companyName.'</p>'; }
                if($_POST['hideSalary'] != 'on'){ echo '<p class="jobLocation"><strong>Salary: </strong>'.$_POST['salary'].'</p>'; }
			}
                for($i=1;$i<=5;$i++)
                {
                    if(isset($_POST['state'.$i]) && isset($_POST['city'.$i]))
                    { echo '<p class="jobLocation">'.$_POST['city'.$i].', '.${'state'.$i}.'</p>'; }
                }
                echo '<p>Date Posted: '.date("m/d/y").'</p>'; 
			
            ?>
            <p>&nbsp;</p>
            <p><?php echo nl2br($_POST['description']); ?></p>
            <p>&nbsp;</p>
            <p style="text-align:center;"><a href="javascript:void(0);" id="submitPost"></a></p>
                    <div id="loading"><img src="/sandbox1/media/images/loader.gif" alt="Loading..." /></div>
                    <div id="feedback"></div>
            <div id="form" class="applyForm">
                <fieldset>
                    <legend>Apply Here!</legend>
                    <form>
                        <p>
                            <label for="fName">First Name: </label>
                            <input type="text" name="fName" id="fName" class="input" value=""/>
                        </p>
                        <p>
                            <label for="lName">Last Name: </label>
                            <input type="text" name="lName" id="lName" class="input" value=""/>
                        </p>
                        <p>
                            <label for="email">Email Address: </label>
                            <input type="text" name="email" id="email" class="input" value=""/>
                        </p>
                        <p>
                            <label for="confEmail">Confirm Email Address: </label>
                            <input type="text" name="confEmail" id="confEmail" class="input" value=""/>
                        </p>
                        <p>
                            <label for="resumeText">Copy/Paste Resume: </label>
                            <textarea name="resumeText" id="resumeText"></textarea>
                        </p>
                    </form>
                </fieldset>
            </div>
        </section>
    </div>
<?php include 'includes/footer.inc.php'; ?>